import http from '@/util/request.js'

export default {
    // 根据id获取秒杀结果信息
    getResultById: (id) => {
        return http({
            url: `/api/seckill/result/${id}`,
            method: 'get'
        })
    },

    // 根据用户id获取秒杀结果列表
    getResultsByUserId: (userId) => {
        return http({
            url: `/api/seckill/result/user/${userId}`,
            method: 'get'
        })
    },

    // 根据秒杀商品id获取秒杀结果列表
    getResultsBySeckillGoodsId: (seckillGoodsId) => {
        return http({
            url: `/api/seckill/result/seckillgoods/${seckillGoodsId}`,
            method: 'get'
        })
    },

    // 根据活动id获取秒杀结果列表
    getResultsByActivityId: (activityId) => {
        return http({
            url: `/api/seckill/result/activity/${activityId}`,
            method: 'get'
        })
    },

    // 添加秒杀结果
    addResult: (data) => {
        return http({
            url: '/api/seckill/result/add',
            method: 'post',
            data
        })
    },

    // 更新秒杀结果
    updateResult: (data) => {
        return http({
            url: '/api/seckill/result/update',
            method: 'put',
            data
        })
    },

    // 删除秒杀结果(软删除)
    deleteResult: (id) => {
        return http({
            url: `/api/seckill/result/delete/${id}`,
            method: 'delete'
        })
    },

    // 获取秒杀结果列表
    getResultList: (data) => {
        return http({
            url: '/api/seckill/result/list',
            method: 'get',
            params: data
        })
    },

    // 获取秒杀结果分页列表
    getResultPage: (current, size, data) => {
        return http({
            url: '/api/seckill/result/page',
            method: 'get',
            params: {
                current: current,
                size: size,
                ...data
            }
        })
    }
}
